package javaJob.exercise.primary.array;

public class primary8 {
    public static void main(String[] args) {
        int[] nums = {0,1,0,3,1,2};
        int[] nums2 = {0};
        moveZeroes(nums);
    }

    static void moveZeroes(int[] nums) {
        for (int i=0,j=0;i<nums.length;i++){
            if (nums[i]==0){
                j=i;
                for (int l=i;l<nums.length;l++){
                    if (nums[l]!=0){
                        nums[j]=nums[l];
                        nums[l]=0;
                        break;
                    }
                }
            }
        }
        for (int k=0;k<nums.length;k++){
            System.out.print(nums[k]);
        }
    }
}
